﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QunYing.Common;
using System.Timers;
using System.ServiceModel;
using System.Diagnostics;

namespace Client
{
  public  class WarnInfoReceiver
    {
      public static WarnInfoReceiver Instance = new WarnInfoReceiver();
  
      IWarnInfoService wis;
      public void Start()
      {
           WarnInfoProcess wp = new WarnInfoProcess();
           NetTcpBinding bind = new NetTcpBinding();
           bind.MaxReceivedMessageSize = 1024 * 1024;
           bind.ReaderQuotas.MaxArrayLength = 1024 * 1024;
           bind.ReaderQuotas.MaxStringContentLength = 1024 * 1024;
           bind.Security.Mode = SecurityMode.None;
           bind.ReceiveTimeout = TimeSpan.MaxValue;
           bind.ReliableSession.InactivityTimeout =   TimeSpan.MaxValue;
           wis = DuplexChannelFactory<IWarnInfoService>.CreateChannel(wp,bind,new EndpointAddress(QunYing.Common.GlobalInfo.ServiceBaseAddr+QunYing.Common.GlobalInfo.ServiceWarnInfoProcess));
           wis.RegisterListener(GlobalInfo.UserLoginInfo.用户ID,GlobalInfo.UserLoginInfo.角色);

      }
    }
}
